const withCss = require('@zeit/next-css')
const withLess = require('@zeit/next-less')
const cssLoaderGetLocalIdent = require('@zeit/next-css/node_modules/css-loader/lib/getLocalIdent.js');


if (typeof require !== 'undefined') {}

module.exports = withLess(withCss({
  cssModules: true,
  cssLoaderOptions: {
    importLoaders: 1,
    localIdentName: "[local]___[hash:base64:5]",
    getLocalIdent: (context, localIdentName, localName, options) => {
      let hz = context.resourcePath && context.resourcePath.replace(context.rootContext, "");
      if (/node_modules/.test(hz)) {
        return localName;
      }
      return cssLoaderGetLocalIdent(context, localIdentName, localName, options);
    }
  },
  lessLoaderOptions: {
    javascriptEnabled: true,
    importLoaders: 1,
    localIdentName: "[local]___[hash:base64:5]",
  },
  webpack(config, options) {
    return config
  }
}))